package com.kx.kxblog.service.impl;

import com.kx.kxblog.dao.CategoryDao;
import com.kx.kxblog.entity.Category;
import com.kx.kxblog.service.CategoryService;
import com.kx.kxblog.util.SystemContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;

@Service
public class CategoryServiceImpl extends AbstractServiceImpl<Category, Integer, CategoryDao> implements CategoryService {
    @Autowired
    public void setDao(CategoryDao dao){
        this.dao = dao;
    }

    @Override
    public Collection<Category> my() {
        return dao.findByUserId(SystemContext.getLoginUser().getId());
    }

    @Override
    public Collection<Category> getByUserId(int userId) {
        return dao.findByUserId(userId);
    }
}
